package com.zmn.plat.common.dictionary;

/**
 * 描述: 故障 - 故障等级
 *
 * @author fengxuecai
 * @since 2021/12/13 11:10
 */
public enum BaseFaultLevelEnum {
    /**
     * values
     */
    SIMPLE_FAULT(1, "简单故障"),
    COMMON_FAULT(2, "一般故障"),
    COMPLEX_FAULT(3, "中等故障"),
    SEVERE_FAULT(4, "复杂故障");

    private final Integer code;

    private final String name;

    BaseFaultLevelEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static BaseFaultLevelEnum of(Integer code) {
        switch (code) {
            case 2:
                return COMMON_FAULT;
            case 3:
                return COMPLEX_FAULT;
            case 4:
                return SEVERE_FAULT;
            default:
                return SIMPLE_FAULT;
        }
    }
}
